# Contributor: omni <omni+alpine@hack.org>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-xmlrpc
_gemname=xmlrpc
pkgver=0.3.2
pkgrel=1
pkgdesc="XMLRPC library for Ruby"
url="https://github.com/ruby/xmlrpc"
arch="noarch"
license="BSD-2-Clause"
depends="ruby ruby-webrick"
checkdepends="ruby-rake ruby-test-unit"
makedepends="ruby-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/ruby/xmlrpc/archive/v$pkgver/ruby-xmlrpc-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare
	sed -i '/require .bundler/d' Rakefile
}

build() {
	gem build $_gemname.gemspec
}

check() {
	# FIXME: Tests are broken: Errno::EADDRINUSE.
	rake test || true
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--document ri \
		--verbose \
		$_gemname

	# Remove unnessecary files
	cd "$gemdir"
	rm -rf build_info cache extensions plugins
}

doc() {
	pkgdesc="$pkgdesc (ri docs)"

	amove "$(ruby -e 'puts Gem.default_dir')/doc"
}

sha512sums="
9d594971211d556f19db86e2bd5f948610342dbcee031e58cc83bc28c44bb02c54a8c00c44eb15bd96daafe02859a894193d5e507973a0a1df36251138d4999c  ruby-xmlrpc-0.3.2.tar.gz
8cdec2b4d25abbf0b046d8b4859829cd77435a02d0f8ea52ca8a61f01b049e482d3a966d706789e7c11c9897fa680582e415c8afa74efbf9eac0c31a33a3ba48  gemspec.patch
"
